package com.android.aishangauction.model.member;

import com.google.gson.Gson;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import java.lang.reflect.Type;
import java.util.List;

/**
 * Created by lnest-php on 2017/9/13.
 */

public class DirectBuyFirmOrderData {

    /**
     * data : {"cart_type":0,"cart_goods":[{"id":"77","mid":"1112","goods_id":"467","spec":"","goods_name":"春节特享 海鲜盛宴(Ocean Gala) 熟冻智利帝王蟹 1500g 礼盒装","cost_price":"0.00","goods_price":"399.00","goods_score":"0","qty":"2","subtotal":798,"subtotal_score":0,"type":"0","obj_id":"0","is_selected":"1","goods_cid":"44","goods_stock":"9950","goods_is_sale":"1","goods_weight":"0","goods_weight_unit":"","goods_sp_val":"","thumb":"[{\"path\":\"\\/upload\\/1\\/images\\/gallery\\/r\\/j\\/992_src.jpg\",\"title\":\"01\"}]","img_src":"http://jm.lnest.cc/upload/1/images/gallery/r/j/992_src.jpg","url":"/goods/show/467"}],"address_list":[{"id":"389","mid":"1112","username":"android01","name":"辅导教师","mobile":"13512345678","zone":"500","area":"北京  东城区","address":"宇宙中心五道口","zip":"","is_default":"0"},{"id":"390","mid":"1112","username":"android01","name":"干豆腐","mobile":"13512312312","zone":"500","area":"北京  东城区","address":"大都会热道具","zip":"","is_default":"0"},{"id":"392","mid":"1112","username":"android01","name":"张江","mobile":"13512345677","zone":"500","area":"北京  东城区","address":"好思达科技","zip":"","is_default":"0"},{"id":"393","mid":"1112","username":"android01","name":"章程","mobile":"13512345677","zone":"531","area":"福建  龙岩  新罗区","address":"时代光华","zip":"","is_default":"0"}],"address":{"id":"389","mid":"1112","username":"android01","name":"辅导教师","mobile":"13512345678","zone":"500","area":"北京  东城区","address":"宇宙中心五道口","zip":"","is_default":"0"},"weight":0,"flow_user_money":false,"flow_user_score":0,"total":{"score_amout":0,"goods_amount":"798.00"},"token":"89c5aa80c01a4a742cd5657dde3623b9"}
     * flag : true
     * code : 0
     * msg : 操作成功
     * time : 1505441468
     */
    public static class DirectBuyFirmOrderDataDeserializer implements JsonDeserializer<DirectBuyFirmOrderData> {
        @Override
        public DirectBuyFirmOrderData deserialize(JsonElement jsonEle, Type type,
                                    JsonDeserializationContext context)
        {
            JsonObject obj = jsonEle.getAsJsonObject();

            if (obj.get("data").getAsJsonObject().get("address").isJsonArray())
            {
                obj.get("data").getAsJsonObject().remove("address");
            }
            if (obj.get("data").getAsJsonObject().get("address_list").isJsonArray())
            {
                obj.get("data").getAsJsonObject().remove("address_list");
            }
            return new Gson().fromJson(obj,DirectBuyFirmOrderData.class);
        }
    }
    private DataBean data;
    private boolean flag;
    private int code;
    private String msg;
    private int time;

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public static class DataBean {
        /**
         * cart_type : 0
         * cart_goods : [{"id":"77","mid":"1112","goods_id":"467","spec":"","goods_name":"春节特享 海鲜盛宴(Ocean Gala) 熟冻智利帝王蟹 1500g 礼盒装","cost_price":"0.00","goods_price":"399.00","goods_score":"0","qty":"2","subtotal":798,"subtotal_score":0,"type":"0","obj_id":"0","is_selected":"1","goods_cid":"44","goods_stock":"9950","goods_is_sale":"1","goods_weight":"0","goods_weight_unit":"","goods_sp_val":"","thumb":"[{\"path\":\"\\/upload\\/1\\/images\\/gallery\\/r\\/j\\/992_src.jpg\",\"title\":\"01\"}]","img_src":"http://jm.lnest.cc/upload/1/images/gallery/r/j/992_src.jpg","url":"/goods/show/467"}]
         * address_list : [{"id":"389","mid":"1112","username":"android01","name":"辅导教师","mobile":"13512345678","zone":"500","area":"北京  东城区","address":"宇宙中心五道口","zip":"","is_default":"0"},{"id":"390","mid":"1112","username":"android01","name":"干豆腐","mobile":"13512312312","zone":"500","area":"北京  东城区","address":"大都会热道具","zip":"","is_default":"0"},{"id":"392","mid":"1112","username":"android01","name":"张江","mobile":"13512345677","zone":"500","area":"北京  东城区","address":"好思达科技","zip":"","is_default":"0"},{"id":"393","mid":"1112","username":"android01","name":"章程","mobile":"13512345677","zone":"531","area":"福建  龙岩  新罗区","address":"时代光华","zip":"","is_default":"0"}]
         * address : {"id":"389","mid":"1112","username":"android01","name":"辅导教师","mobile":"13512345678","zone":"500","area":"北京  东城区","address":"宇宙中心五道口","zip":"","is_default":"0"}
         * weight : 0
         * flow_user_money : false
         * flow_user_score : 0
         * total : {"score_amout":0,"goods_amount":"798.00"}
         * token : 89c5aa80c01a4a742cd5657dde3623b9
         */
        private int cart_type;
        private AddressBean address;
        private int weight;
        private boolean flow_user_money;
        private String flow_user_score;
        private TotalBean total;
        private String token;
        private List<CartGoodsBean> cart_goods;
        private List<AddressListBean> address_list;
        public int getCart_type() {
            return cart_type;
        }

        public void setCart_type(int cart_type) {
            this.cart_type = cart_type;
        }

        public AddressBean getAddress() {
            return address;
        }

        public void setAddress(AddressBean address) {
            this.address = address;
        }

        public int getWeight() {
            return weight;
        }

        public void setWeight(int weight) {
            this.weight = weight;
        }

        public boolean isFlow_user_money() {
            return flow_user_money;
        }

        public void setFlow_user_money(boolean flow_user_money) {
            this.flow_user_money = flow_user_money;
        }

        public String getFlow_user_score() {
            return flow_user_score;
        }

        public void setFlow_user_score(String flow_user_score) {
            this.flow_user_score = flow_user_score;
        }

        public TotalBean getTotal() {
            return total;
        }

        public void setTotal(TotalBean total) {
            this.total = total;
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public List<CartGoodsBean> getCart_goods() {
            return cart_goods;
        }

        public void setCart_goods(List<CartGoodsBean> cart_goods) {
            this.cart_goods = cart_goods;
        }

        public List<AddressListBean> getAddress_list() {
            return address_list;
        }

        public void setAddress_list(List<AddressListBean> address_list) {
            this.address_list = address_list;
        }

        public static class AddressBean {
            /**
             * id : 389
             * mid : 1112
             * username : android01
             * name : 辅导教师
             * mobile : 13512345678
             * zone : 500
             * area : 北京  东城区
             * address : 宇宙中心五道口
             * zip :
             * is_default : 0
             */

            private String id;
            private String mid;
            private String username;
            private String name;
            private String mobile;
            private String zone;
            private String area;
            private String address;
            private String zip;
            private String is_default;

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getMid() {
                return mid;
            }

            public void setMid(String mid) {
                this.mid = mid;
            }

            public String getUsername() {
                return username;
            }

            public void setUsername(String username) {
                this.username = username;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public String getMobile() {
                return mobile;
            }

            public void setMobile(String mobile) {
                this.mobile = mobile;
            }

            public String getZone() {
                return zone;
            }

            public void setZone(String zone) {
                this.zone = zone;
            }

            public String getArea() {
                return area;
            }

            public void setArea(String area) {
                this.area = area;
            }

            public String getAddress() {
                return address;
            }

            public void setAddress(String address) {
                this.address = address;
            }

            public String getZip() {
                return zip;
            }

            public void setZip(String zip) {
                this.zip = zip;
            }

            public String getIs_default() {
                return is_default;
            }

            public void setIs_default(String is_default) {
                this.is_default = is_default;
            }
        }

        public static class TotalBean {
            /**
             * score_amout : 0
             * goods_amount : 798.00
             */

            private int score_amout;
            private String goods_amount;

            public int getScore_amout() {
                return score_amout;
            }

            public void setScore_amout(int score_amout) {
                this.score_amout = score_amout;
            }

            public String getGoods_amount() {
                return goods_amount;
            }

            public void setGoods_amount(String goods_amount) {
                this.goods_amount = goods_amount;
            }
        }

        public static class CartGoodsBean {
            /**
             * id : 77
             * mid : 1112
             * goods_id : 467
             * spec :
             * goods_name : 春节特享 海鲜盛宴(Ocean Gala) 熟冻智利帝王蟹 1500g 礼盒装
             * cost_price : 0.00
             * goods_price : 399.00
             * goods_score : 0
             * qty : 2
             * subtotal : 798
             * subtotal_score : 0
             * type : 0
             * obj_id : 0
             * is_selected : 1
             * goods_cid : 44
             * goods_stock : 9950
             * goods_is_sale : 1
             * goods_weight : 0
             * goods_weight_unit :
             * goods_sp_val :
             * thumb : [{"path":"\/upload\/1\/images\/gallery\/r\/j\/992_src.jpg","title":"01"}]
             * img_src : http://jm.lnest.cc/upload/1/images/gallery/r/j/992_src.jpg
             * url : /goods/show/467
             */

            private String id;
            private String mid;
            private String goods_id;
            private String spec;
            private String goods_name;
            private String cost_price;
            private String goods_price;
            private String goods_score;
            private String qty;
            private float subtotal;
            private int subtotal_score;
            private String type;
            private String obj_id;
            private String is_selected;
            private String goods_cid;
            private String goods_stock;
            private String goods_is_sale;
            private String goods_weight;
            private String goods_weight_unit;
            private String goods_sp_val;
            private String thumb;
            private String img_src;
            private String url;

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getMid() {
                return mid;
            }

            public void setMid(String mid) {
                this.mid = mid;
            }

            public String getGoods_id() {
                return goods_id;
            }

            public void setGoods_id(String goods_id) {
                this.goods_id = goods_id;
            }

            public String getSpec() {
                return spec;
            }

            public void setSpec(String spec) {
                this.spec = spec;
            }

            public String getGoods_name() {
                return goods_name;
            }

            public void setGoods_name(String goods_name) {
                this.goods_name = goods_name;
            }

            public String getCost_price() {
                return cost_price;
            }

            public void setCost_price(String cost_price) {
                this.cost_price = cost_price;
            }

            public String getGoods_price() {
                return goods_price;
            }

            public void setGoods_price(String goods_price) {
                this.goods_price = goods_price;
            }

            public String getGoods_score() {
                return goods_score;
            }

            public void setGoods_score(String goods_score) {
                this.goods_score = goods_score;
            }

            public String getQty() {
                return qty;
            }

            public void setQty(String qty) {
                this.qty = qty;
            }

            public float getSubtotal() {
                return subtotal;
            }

            public void setSubtotal(float subtotal) {
                this.subtotal = subtotal;
            }

            public int getSubtotal_score() {
                return subtotal_score;
            }

            public void setSubtotal_score(int subtotal_score) {
                this.subtotal_score = subtotal_score;
            }

            public String getType() {
                return type;
            }

            public void setType(String type) {
                this.type = type;
            }

            public String getObj_id() {
                return obj_id;
            }

            public void setObj_id(String obj_id) {
                this.obj_id = obj_id;
            }

            public String getIs_selected() {
                return is_selected;
            }

            public void setIs_selected(String is_selected) {
                this.is_selected = is_selected;
            }

            public String getGoods_cid() {
                return goods_cid;
            }

            public void setGoods_cid(String goods_cid) {
                this.goods_cid = goods_cid;
            }

            public String getGoods_stock() {
                return goods_stock;
            }

            public void setGoods_stock(String goods_stock) {
                this.goods_stock = goods_stock;
            }

            public String getGoods_is_sale() {
                return goods_is_sale;
            }

            public void setGoods_is_sale(String goods_is_sale) {
                this.goods_is_sale = goods_is_sale;
            }

            public String getGoods_weight() {
                return goods_weight;
            }

            public void setGoods_weight(String goods_weight) {
                this.goods_weight = goods_weight;
            }

            public String getGoods_weight_unit() {
                return goods_weight_unit;
            }

            public void setGoods_weight_unit(String goods_weight_unit) {
                this.goods_weight_unit = goods_weight_unit;
            }

            public String getGoods_sp_val() {
                return goods_sp_val;
            }

            public void setGoods_sp_val(String goods_sp_val) {
                this.goods_sp_val = goods_sp_val;
            }

            public String getThumb() {
                return thumb;
            }

            public void setThumb(String thumb) {
                this.thumb = thumb;
            }

            public String getImg_src() {
                return img_src;
            }

            public void setImg_src(String img_src) {
                this.img_src = img_src;
            }

            public String getUrl() {
                return url;
            }

            public void setUrl(String url) {
                this.url = url;
            }
        }

        public static class AddressListBean {
            /**
             * id : 389
             * mid : 1112
             * username : android01
             * name : 辅导教师
             * mobile : 13512345678
             * zone : 500
             * area : 北京  东城区
             * address : 宇宙中心五道口
             * zip :
             * is_default : 0
             */

            private String id;
            private String mid;
            private String username;
            private String name;
            private String mobile;
            private String zone;
            private String area;
            private String address;
            private String zip;
            private String is_default;

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getMid() {
                return mid;
            }

            public void setMid(String mid) {
                this.mid = mid;
            }

            public String getUsername() {
                return username;
            }

            public void setUsername(String username) {
                this.username = username;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public String getMobile() {
                return mobile;
            }

            public void setMobile(String mobile) {
                this.mobile = mobile;
            }

            public String getZone() {
                return zone;
            }

            public void setZone(String zone) {
                this.zone = zone;
            }

            public String getArea() {
                return area;
            }

            public void setArea(String area) {
                this.area = area;
            }

            public String getAddress() {
                return address;
            }

            public void setAddress(String address) {
                this.address = address;
            }

            public String getZip() {
                return zip;
            }

            public void setZip(String zip) {
                this.zip = zip;
            }

            public String getIs_default() {
                return is_default;
            }

            public void setIs_default(String is_default) {
                this.is_default = is_default;
            }
        }
    }
}
